[test_pfcwd_timer_accuracy] handle exception during grep log#16446
[test_pfcwd_timer_accuracy] handle exception during grep log#16446StormLiangMS merged 1 commit intosonic-net:masterfrom
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@lipxu PR conflicts with 202405 branch |
|
@lipxu PR conflicts with 202411 branch |
|
202405 |
|
202411 |
|
|
||
| # Regular expressions for the two timestamp formats | ||
| regex1 = re.compile(r'^[A-Za-z]{3} \d{2} \d{2}:\d{2}:\d{2}\.\d{6}') | ||
| regex2 = re.compile(r'^\d{4} [A-Za-z]{3} \d{2} \d{2}:\d{2}:\d{2}\.\d{6}') |
There was a problem hiding this comment.
@lipxu is there any reasons why we're switching to regex here?
There was a problem hiding this comment.
Sorry, @auspham , just saw the comments. sorry for the late response.
I used regex here because I initially aimed to standardize the handling function by searching for the timestamp and processing it with the same function, however, during UT test, I found the date command does not support the format with the year. therefore, I reverted to the previous handling process but retained the regex change here. thanks.
There was a problem hiding this comment.
Maybe we can only search the timestamp without year, let me try
Description of PR Summary: Fixes # (issue) 31202914 From #16446 we are changing to use regex to capture the timestamp for pfc timer accuracy. However, the regex does not cover the scenario where date digit is 1. For example: 2025 Jan 5 00:53:14.103188 Approach What is the motivation for this PR? Comparing between: 2025 Jan 26 17:36:31.27789 2025 Feb 2 15:17:24.055182 We can see that we might need up to 2 spaces after month and the number of day digits can vary between 1 to 2. How did you do it? Adjust the regex so it matches for both format How did you verify/test it? image Signed-off-by: Austin Pham <austinpham@microsoft.com>
Description of PR Summary: Fixes # (issue) 31202914 From sonic-net#16446 we are changing to use regex to capture the timestamp for pfc timer accuracy. However, the regex does not cover the scenario where date digit is 1. For example: 2025 Jan 5 00:53:14.103188 Approach What is the motivation for this PR? Comparing between: 2025 Jan 26 17:36:31.27789 2025 Feb 2 15:17:24.055182 We can see that we might need up to 2 spaces after month and the number of day digits can vary between 1 to 2. How did you do it? Adjust the regex so it matches for both format How did you verify/test it? image Signed-off-by: Austin Pham <austinpham@microsoft.com>
Description of PR Summary: Fixes # (issue) 31202914 From #16446 we are changing to use regex to capture the timestamp for pfc timer accuracy. However, the regex does not cover the scenario where date digit is 1. For example: 2025 Jan 5 00:53:14.103188 Approach What is the motivation for this PR? Comparing between: 2025 Jan 26 17:36:31.27789 2025 Feb 2 15:17:24.055182 We can see that we might need up to 2 spaces after month and the number of day digits can vary between 1 to 2. How did you do it? Adjust the regex so it matches for both format How did you verify/test it? image Signed-off-by: Austin Pham <austinpham@microsoft.com>
|
@lipxu We saw the error below recently. Can you help check if the error is caused by this change? |
Description of PR Summary: Fixes # (issue) 31202914 From sonic-net#16446 we are changing to use regex to capture the timestamp for pfc timer accuracy. However, the regex does not cover the scenario where date digit is 1. For example: 2025 Jan 5 00:53:14.103188 Approach What is the motivation for this PR? Comparing between: 2025 Jan 26 17:36:31.27789 2025 Feb 2 15:17:24.055182 We can see that we might need up to 2 spaces after month and the number of day digits can vary between 1 to 2. How did you do it? Adjust the regex so it matches for both format How did you verify/test it? image Signed-off-by: Austin Pham <austinpham@microsoft.com>
Description of PR Summary: Fixes # (issue) 31202914 From #16446 we are changing to use regex to capture the timestamp for pfc timer accuracy. However, the regex does not cover the scenario where date digit is 1. For example: 2025 Jan 5 00:53:14.103188 Approach What is the motivation for this PR? Comparing between: 2025 Jan 26 17:36:31.27789 2025 Feb 2 15:17:24.055182 We can see that we might need up to 2 spaces after month and the number of day digits can vary between 1 to 2. How did you do it? Adjust the regex so it matches for both format How did you verify/test it? image Signed-off-by: Austin Pham <austinpham@microsoft.com>
Hi, @bingwang-ms , Yes, should be related to the timestamp parser, it fixed by the PR #16757, please let me know if we still hit the issue with this fix, thanks |
<!-- Please make sure you've read and understood our contributing guidelines; https://github.com/sonic-net/SONiC/blob/gh-pages/CONTRIBUTING.md Please provide following information to help code review process a bit easier: --> ### Description of PR <!-- - Please include a summary of the change and which issue is fixed. - Please also include relevant motivation and context. Where should reviewer start? background context? - List any dependencies that are required for this change. --> Summary: Fixes # (issue) 31202914 From sonic-net#16446 we are changing to use regex to capture the timestamp for pfc timer accuracy. However, the regex does not cover the scenario where date digit is 1. For example: `2025 Jan 5 00:53:14.103188 ` ### Type of change <!-- - Fill x for your type of change. - e.g. - [x] Bug fix --> - [ ] Bug fix - [ ] Testbed and Framework(new/improvement) - [ ] New Test case - [ ] Skipped for non-supported platforms - [ ] Test case improvement ### Back port request - [ ] 202012 - [ ] 202205 - [ ] 202305 - [ ] 202311 - [ ] 202405 - [ ] 202411 ### Approach #### What is the motivation for this PR? Comparing between: - `2025 Jan 26 17:36:31.27789` - `2025 Feb 2 15:17:24.055182` We can see that we might need up to 2 spaces after month and the number of day digits can vary between 1 to 2. #### How did you do it? Adjust the regex so it matches for both format #### How did you verify/test it?  #### Any platform specific information? #### Supported testbed topology if it's a new test case? ### Documentation <!-- (If it's a new feature, new test case) Did you update documentation/Wiki relevant to your implementation? Link to the wiki page? -->
…et#16446) What is the motivation for this PR? Since the test environment limitation, sometimes, pfcwd could not be triggered expectedly. It would cause exception failure due to grep pfc watchdog syslog return failure. How did you do it? Handle the exception, return failure instead of raise an exception. How did you verify/test it? inject an failure and run the case locally. pfcwd/test_pfcwd_timer_accuracy.py::TestPfcwdAllTimer::test_pfcwd_timer_accuracy[bjw-can-7050qx-1] ---------------------------------------------------------------------------------------------------------------------- live log call ----------------------------------------------------------------------------------------------------------------------- 05:57:06 test_pfcwd_timer_accuracy.retrieve_times L0371 WARNING| ##### Randomly skip timestamp 05:56:16.168697 parsing for pattern: [d]etected PFC storm 05:57:26 test_pfcwd_timer_accuracy.run_test L0228 WARNING| storm_start_ms 1736488575601 or storm_detect_ms 0 or storm_end_ms 1736488588756 or storm_restore_ms 1736488589364 is 0 05:57:26 test_pfcwd_timer_accuracy.run_test L0232 WARNING| Skip this loop due to missing timestamps 06:16:58 test_pfcwd_timer_accuracy.retrieve_times L0371 WARNING| ##### Randomly skip timestamp 06:16:07.324006 parsing for pattern: [d]etected PFC storm 06:17:17 test_pfcwd_timer_accuracy.run_test L0228 WARNING| storm_start_ms 1736489766762 or storm_detect_ms 0 or storm_end_ms 1736489779979 or storm_restore_ms 1736489780540 is 0 06:17:17 test_pfcwd_timer_accuracy.run_test L0232 WARNING| Skip this loop due to missing timestamps 06:20:04 test_pfcwd_timer_accuracy.retrieve_times L0371 WARNING| ##### Randomly skip timestamp 06:19:08.259521 parsing for pattern: [P]FC_STORM_END 06:20:06 test_pfcwd_timer_accuracy.run_test L0228 WARNING| storm_start_ms 1736489935710 or storm_detect_ms 1736489936402 or storm_end_ms 0 or storm_restore_ms 1736489948823 is 0 06:20:06 test_pfcwd_timer_accuracy.run_test L0232 WARNING| Skip this loop due to missing timestamps 06:21:30 test_pfcwd_timer_accuracy.retrieve_times L0371 WARNING| ##### Randomly skip timestamp 06:20:36.569082 parsing for pattern: [s]torm restored 06:21:30 test_pfcwd_timer_accuracy.run_test L0228 WARNING| storm_start_ms 1736490020022 or storm_detect_ms 1736490020552 or storm_end_ms 1736490035837 or storm_restore_ms 0 is 0 06:21:30 test_pfcwd_timer_accuracy.run_test L0232 WARNING| Skip this loop due to missing timestamps PASSED Any platform specific information?
Description of PR Summary: Fixes # (issue) 31202914 From sonic-net#16446 we are changing to use regex to capture the timestamp for pfc timer accuracy. However, the regex does not cover the scenario where date digit is 1. For example: 2025 Jan 5 00:53:14.103188 Approach What is the motivation for this PR? Comparing between: 2025 Jan 26 17:36:31.27789 2025 Feb 2 15:17:24.055182 We can see that we might need up to 2 spaces after month and the number of day digits can vary between 1 to 2. How did you do it? Adjust the regex so it matches for both format How did you verify/test it? image Signed-off-by: Austin Pham <austinpham@microsoft.com>
Description of PR
Summary:
Fixes # (issue)
29970341
Type of change
Back port request
Approach
What is the motivation for this PR?
Since the test environment limitation, sometimes, pfcwd could not be triggered expectedly.
It would cause exception failure due to grep pfc watchdog syslog return failure.
How did you do it?
Handle the exception, return failure instead of raise an exception.
How did you verify/test it?
inject an failure and run the case locally.
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation